<template>
  <div>
    <!-- 左侧导航区域 -->
    <div class="navbar">
      <el-menu
        :default-active="$route.path"
        class="el-menu-vertical-demo"
        background-color="#545c64"
        text-color="#fff"
        active-text-color="#ffd04b"
      >
        <el-menu-item
          :index="item.path"
          v-for="item in navList"
          :key="item.id"
          @click="goto(item.path)"
        >
          <i :class="item.icon"></i>
          <span slot="title">{{ item.title }}</span>
        </el-menu-item>
        <!-- <el-menu-item index="3">
          <i class="el-icon-goods"></i>
          <span slot="title">商品管理</span>
        </el-menu-item>
        <el-menu-item index="4">
          <i class="el-icon-s-order"></i>
          <span slot="title">订单管理</span>
        </el-menu-item>
        <el-menu-item index="4">
          <i class="el-icon-s-management"></i>
          <span slot="title">评论管理</span>
        </el-menu-item> -->
      </el-menu>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      navList: [
        {
          id: 1,
          title: "用户管理",
          path: "/home/users",
          icon: "el-icon-user"
        },
        {
          id: 2,
          title: "商品管理",
          path: "/home/goods",
          icon: "el-icon-goods"
        },
        {
          id: 3,
          title: "订单管理",
          path: "/home/orders",
          icon: "el-icon-s-order"
        },
        {
          id: 4,
          title: "评论管理",
          path: "/home/comments",
          icon: "el-icon-s-management"
        }
      ]
    };
  },

  components: {},

  methods: {
    goto(path) {
      this.$router.push(path);
    }
  }
};
</script>

<style scoped>
/* 左侧导航栏 */
.navbar {
  position: absolute;
  width: 230px;
  top: 50px;
  left: 0px;
  bottom: 0px;
  overflow-y: auto;
  background-color: #545c64;
}
</style>